/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Framework;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
/**
 *
 * @author WanbooUIT
 */

public class CMenuItem 
{
    public int idItem;
    public CRect rectItem;
    public Image imgItem;
    public CVector2D posItem;//in pixel
    
    public CMenuItem(int _id,CVector2D _pos,CVector2D _wh,Image _img)
    {
        idItem = _id;
        imgItem = _img;
        posItem = _pos;
        rectItem = new CRect(this.posItem.x,this.posItem.y,_wh.x,_wh.y);
    }


    public void draw(Graphics g)
    {
        if(imgItem != null)
        {
            g.drawImage(imgItem,(int) this.posItem.x,(int) this.posItem.y, Graphics.TOP | Graphics.BOTTOM);
        }
    }
    
    public boolean isContainTouch(int _x,int _y)
    {
        if(this.rectItem.Containt((float) _x, (float) _y))
        {
            
            return true;
        }
        
        return false;
    }
   
}
